package com.ty.service;

import com.ty.dao.ProductDao;
import com.ty.entity.Product;
import com.ty.entity.ProductQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductService {

    @Autowired
    private ProductDao productDao;

    //缺点： 1. 所有方方法的返回的类型PageInfo  2. 返回信息字段太多

    public List<Product> select (ProductQuery query){
        List<Product> products = productDao.select(query);
        return products;
    }

    public int insert (Product product){
        return productDao.insert( product);
    }

    public int update(Product product) {
        return   productDao.update(product);
    }

    public int delete (Integer id){
        return productDao.delete(id);
    }
}
